home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / KILL.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  1KB  |  38 lines

  1. ' KILL.BAS
  2. ' This program lets you delete a file in the current directory.
  3.  
  4. CLS
  5.  
  6. PRINT "The current directory contains the following files:"
  7. PRINT
  8.  
  9. FILES "*.*"                ' display files in current directory
  10.  
  11. PRINT                      ' get file to delete
  12. INPUT "Which file(s) would you like to delete?  ", filename$
  13.  
  14. ' check for wildcard characters (? and *) in filename$
  15. '   if they exist, print a warning before deleting multiple files
  16. '   if they do not exist, proceed with deletion
  17. '   if the file does not exist, KILL will display a run-time error
  18.  
  19. IF (INSTR(filename$, "?")) OR (INSTR(filename$, "*")) THEN
  20.     PRINT
  21.     COLOR 4                ' set color to red for effect
  22.     PRINT "Danger:  Wildcards detected that can delete multiple files!"
  23.     COLOR 7                ' set color to default white
  24.     PRINT                  ' prompt for deletion confirmation
  25.     INPUT "Do you want to proceed (Y,N)?  ", reply$
  26.                            ' if reply$ is yes then delete file
  27.     IF (UCASE$(reply$) = "Y") THEN
  28.         KILL filename$
  29.         PRINT
  30.         PRINT UCASE$(filename$); " deleted from system"
  31.     END IF                 ' ...if not then exit program
  32. ELSE
  33.     KILL filename$         ' if no wildcards exist, simply delete file
  34.     PRINT
  35.     PRINT UCASE$(filename$); " deleted from system"
  36. END IF
  37.  
  38.